<template lang="pug">
  el-dialog(v-bind:visible="dialogVisible" v-bind:before-close="close")
    kalix-upload(v-model="fileUrl" v-bind:isImage="false" style="width:230px" v-bind:action="action")
    el-button(v-on:click="handlerDialogSubmitClick") 提交
</template>

<script>
  import KalixUpload from '../corelib/components/common/baseUpload'

  export default {
    name: 'DialogUpload',
    components: {KalixUpload},
    props: {
      action: {
        type: String,
        default: ''
      }
    },
    data() {
      return {
        dialogVisible: false,
        fileUrl: null
      }
    },
    methods: {
      open() {
        this.dialogVisible = true
      },
      close(_fileUrl) {
        this.dialogVisible = true
        this.$emit('dialogUploadClose', _fileUrl)
      },
      handlerDialogSubmitClick() {
        this.close(this.fileUrl)
      }
    }
  }
</script>

<style scoped>

</style>
